const mongoose = require('mongoose')
const { url } = require('./config/database')

mongoose.set('debug', true)
module.exports = {
  connect: async () => {
    await mongoose.connect(url, {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useCreateIndex: true
    })
  },
  mongo: mongoose,
  close: async () => { await mongoose.disconnect() }
}
